package com.itheima.config;


import com.itheima.interception.TokenInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration//将拦截器加入到WebMvc容器
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] arr = {"/admin/login","/admin/logout","/aliyun/oss/upload"};

        registry.addInterceptor(new TokenInterceptor())//添加拦截器
                .addPathPatterns("/**")//拦截哪些
                .excludePathPatterns(arr);//放行哪些

    }
}
